package net.shopxx.dao.impl;

import java.util.List;
import net.shopxx.dao.PrologOrderDao;
import net.shopxx.entity.PrologOrder;
import org.springframework.stereotype.Repository;

/**
 * Dao实现类 - 生产物流
 */

@Repository
public class PrologOrderDaoImpl extends BaseDaoImpl<PrologOrder, String> implements PrologOrderDao {

	// 关联处理
	@Override
	public void delete(PrologOrder deliveryCorp) {

		super.delete(deliveryCorp);
	}

	// 关联处理
	@Override
	public void delete(String id) {
		PrologOrder prologOrder = load(id);
		this.delete(prologOrder);
	}

	// 关联处理
	@Override
	public void delete(String[] ids) {
		for (String id : ids) {
			PrologOrder prologOrder = load(id);
			this.delete(prologOrder);
		}
	}

	@SuppressWarnings("unchecked")
	public List getLoadByDistrib() {
		String hql = "SELECT Count(produce_id) as aa,distribStaff FROM ProduceOrder  where PrologOrder.isEnabled = '1'  GROUP BY distribStaff";
		return getSession().createQuery(hql).list();
	}

	@Override
	public List getProduceLoadByDistrib() {
		String hql = "SELECT Count(prolog_id) as aa,produceDistribStaff FROM PrologOrder where PrologOrder.isEnabled = '1'  GROUP BY produceDistribStaff";
		return getSession().createQuery(hql).list();
	}

	@Override
	public List getDeliveryLoadByDistrib() {
		String hql = "SELECT Count(prolog_id) as aa,deliveryDistribStaff FROM PrologOrder  where PrologOrder.isEnabled = '1' GROUP BY deliveryDistribStaff";
		return getSession().createQuery(hql).list();
	}


}